﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Data.OleDb;

namespace WindowsFormsApplication3.Administraror.Humanresource
{
    public partial class EmpLoctnChangeForm : Form 
    {
        Transaction.EmployeeTransaction emptransaction = null;
        DataBean.EmployeeDatabean empdatabean = null;
        public EmpLoctnChangeForm( )
        {
            InitializeComponent();
            emptransaction = new Transaction.EmployeeTransaction();
           
        }
        public EmpLoctnChangeForm(ArrayList arrylst)
        {
            InitializeComponent();
            filldata(arrylst);
            emptransaction = new Transaction.EmployeeTransaction();


        }
        public void filldata(ArrayList arrylist)
        {
            txtpk.Text = arrylist[0].ToString();
            txtempname.Text = arrylist[1].ToString();
            txtvisanu.Text = arrylist[2].ToString();
            txtemployecode.Text = arrylist[3].ToString();
            txtpk.Enabled = false;
            txtempname.Enabled = false;
            txtemployecode.Enabled = false;

        }

        private void EmpLoctnChangeForm_Load(object sender, EventArgs e)
        {
          
        }

       
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (cmbCompany.Text == null || cmbCompany.Text.Trim() == "")
            { 
            }
            else

            {
                DataBean.EmployeeDatabean employeeDataBean = getdatatobean();

                if (emptransaction.changeEmployeeLocation(employeeDataBean))
            {
               
                    MessageBox.Show(" Employee Sucessfully Transfered");
                    this.Close();
            }


            }
        }
      private  DataBean.EmployeeDatabean getdatatobean()
        {
            empdatabean = new DataBean.EmployeeDatabean();
            empdatabean.Employeepk = int.Parse(txtpk.Text);
            empdatabean.Visano = txtvisanu.Text;
            empdatabean.Fromdate = dtpfrom.Value.Date;
            empdatabean.Todate = dtpto.Value.Date;
            empdatabean.Remark = rhtremark.Text;
            empdatabean.Emplocation = cmbCompany.Text;
            return empdatabean;
        }
    }
}
